<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .line {
            position: relative;
            width: 300px;
            height: 300px;
        }

        .line::after {
            position: absolute;
            left: 0;
            top: 0;
            content: '';
            width: 200%;
            height: 200%;
            border: 1px solid red;
            transform: scale(0.5);
            transform-origin: left top;
        }
    </style>
</head>

<body>
    <h1>画一条0.5px的线</h1>
    <div class="line"></div>
</body>

</html>